/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */

package mundo;

/**
 * Class represents a Map atom.
 * 
 * @author JuanFer
 */
public class MapPiece
{
    /**
     * Wall type
     */
    public static final int wall = 0;
    
    /**
     * Land type
     */
    public static final int land = 1;
    
    /**
     * Water type
     */
    public static final int water = 2;
    
    /**
     * Plant type
     */
    public static final int plant = 3;

    /**
     * Land with object type.
     */
    public final int obj = 4;

    /**
     * Land with white paint type.
     */
    public final int painted = 5;

    /**
     * Parameter groundType.
     */
    int groundType;

    /**
     * Boolean for there is an object at MapPiece obj.
     */
    boolean hasObj;

    /**
     * Boolean for there is paint at piece of land.
     */
    boolean isPainted;

    int tipo;
    /**
     * Constructor.
     * 
     * @param type
     */
    public MapPiece(int type)
    {
    tipo = type;
	if (type == obj)
	{
	    groundType = land;
	    hasObj = true;
	    isPainted = false;
	} else if (type == painted)
	{
	    groundType = land;
	    hasObj = false;
	    isPainted = true;
	} else if (type == 6)
	{
	    groundType = land;
	    hasObj = true;
	    isPainted = true;
	} else
	{

	    groundType = type;
	    hasObj = false;
	    isPainted = false;
	}
    }

    /**
     * Get method for groundType.
     * 
     * @return groundType
     */
    public int getGroundType()
    {
	return groundType;
    }

    /**
     * set Method for gourndType.
     * 
     * @param groundType
     */
    public void setGroundType(int groundType)
    {
	this.groundType = groundType;
    }

    /**
     * Retuns hasObj value.
     * 
     * @return true is MapPiece has an object
     */
    public boolean isHasObj()
    {
	return hasObj;
    }

    /**
     * Sets hasObj value.
     * 
     * @param hasObj
     */
    public void setHasObj(boolean hasObj)
    {
	this.hasObj = hasObj;
    }

    /**
     * Returns is painted value.
     * 
     * @return true if MapPiece is painted
     */
    public boolean isPainted()
    {
	return isPainted;
    }

    /**
     * Sets is Painted value.
     * 
     * @param isPainted
     */
    public void setIsPainted(boolean isPainted)
    {
	this.isPainted = isPainted;
    }

    /**
     * Returns true if groundType is land, so it is walkable for the robot.
     * 
     * @return true if MapPiece is walkable
     */
    public boolean walkable()
    {
	return groundType == land;
    }
    
    public int getType(){
    	return tipo;
    }

}